<?php
include_once("../../service/categoryService.php");

$catId = $_POST["catId"];
$categories = getAllParentCategoriesOf($catId, null);
$categories[] = array("id" => $catId);

foreach($categories as $each){
    $optionalPrices = getOptionalPricesOfCategory($each["id"]);
    
    while($row = ConnectionManager::getInstance()->fetch($optionalPrices)){
        echo "<li><div>".$row["OPP_NAME"].":</div>";
        
        $optionalItems = findOptionItemByOptionalPrice($row["OPP_ID"]);
        while($item = ConnectionManager::getInstance()->fetch($optionalItems)){
            echo "&nbsp- ".$item["OOI_NAME"]."<br/>";
        }
        echo "</li>";
    }
    /*<input type='text' name='optionalPrices' onkeyup='this.value = formatCurrency(this.value,2);'/><input type='hidden' name='oppIds[]' value='".$row["OPP_ID"]."'/>*/
}
?>